﻿
using Microsoft.EntityFrameworkCore;
using System;

namespace JT.Data
{
    public partial class ContextBase : DbContext
    {
        /// <summary>
        /// 数据库
        /// </summary>
        public enum TypeDB
        {
            MySQL,
            SQLite,
            InMemory,
            SQLServer,
            PostgreSQL
        }
        /// <summary>
        /// 数据库
        /// </summary>
        private readonly TypeDB TDB;

        public ContextBase()
        {
            Enum.TryParse(GlobalTo.GetValue("TypeDB"), true, out TDB);
        }

        public ContextBase(DbContextOptions<ContextBase> options) : base(options)
        {

        }

        //protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        //{
        //    if (!optionsBuilder.IsConfigured)
        //    {
        //        optionsBuilder.UseSqlServer(GlobalTo.GetValue("ConnectionStrings:SQLServerConn"), options =>
        //        {
        //            //启用 row_number 分页 （兼容2005、2008）
        //            options.UseRowNumberForPaging();
        //            options.MigrationsAssembly("JT.WEB");
        //        });
        //    }
        //}
    }
}
